<?php
include '../comm/config.php';	
include 'check.php';
$info=include('../data/hotword.php');
if($_POST['Submit']){
    $info=$_POST['info'];
    $data = "<?php\n return ".var_export($info, true).";\n?>";
    file_put_contents('../data/hotword.php',$data);
	echo "<script>alert('修改成功');window.location='hotword.php'</script>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理中心</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
<script src="js/jquery.js"></script>
<script>

$(function(){
    $('#word').keyup(function(){
	    var word=$(this).val();
		var url='http://<?=URL?>/list.php?q='+encodeURIComponent(word);
		$('#url').val(url);	
	});
})
</script>
<style type="text/css">
<!--
.STYLE3 {color: #FF0000}
-->
</style>
</head>
<body topmargin="5" leftmargin="0">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="282" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td>
          <table cellspacing="0" width="100%" height="207" style="border:1px  solid #DCEAF7;">
            <tr>
              <td height="30" colspan="2" bgcolor="E9F2FB" class="bigtext"><strong>&nbsp;<img src="images/arrow.gif" width="16" height="22" align="absmiddle" />热门搜索词设置设置</strong></td>
            </tr>
            <tr>
              <td width="100%" colspan="2" valign="top"><table width="100%" height="300" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td valign="top"><form id="form1" name="form1" method="post" action="">
                    
                    <table width="100%"  align="center" border=1 cellpadding=0 cellspacing=0style="border-collapse: collapse" bordercolor="#dddddd">
                      <tr>
                        <td width="" height="30" align="right" class="bigtext">显示个数：</td>
                        <td width="" height="30" class="bigtext">&nbsp;
                          <input type="text" style="width:50px" name="info[num]" value="<?=$info['num']?>" /> (根据关键词长度和模板设置)                   
                        </td>
                      </tr>
                     <tr>
                        <td width="135" height="30" align="right" class="bigtext">关键词：</td>
                        <td width="" height="30" class="bigtext">&nbsp;
                          <?php 
						  foreach($info['word'] as $k=>$v){?>
                          <input type="text" style="width:35px" value="<?=$v?>" name="info[word][<?=$k?>]" /> 
                          <?php }?>
                        </td>
                      </tr>
                      <tr>
                        <td width="135" height="30" align="right" class="bigtext">生成链接：</td>
                        <td width="" height="30" class="bigtext">&nbsp;关键词：<input type="text" style="width:65px" id="word"/> 链接：<input type="text" style="width:635px" id="url"/> 
                        </td>
                      </tr>
                      <tr>
                        <td height="30" align="right">&nbsp;</td>
                        <td height="30" class="bigtext">&nbsp;
                          <input type="submit" name="Submit" value=" 保 存 设 置 " /> 
                          &nbsp;&nbsp;&nbsp;</td>
                      </tr>
                    </table>
                  </form>
                  </td>
                </tr>
              </table></td>
            </tr>
          </table></td>
        </tr>
      
    </table></td>
  </tr>
</table>
</body>
</html>
<?php mysql_close();?>